﻿using System;
using System.Data;
using System.Windows.Forms;
using RentalOfCars.Client.Presentation;

namespace RentalOfCars.Client.WinformsClient
{
    public partial class MainWindow : Form, IMainWindowView
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        #region IMainWindowView Members

        public DataTable EmployeesTable
        {
            set { _dgvEmployees.DataSource = value; }
        }

        public DataTable CarsTable
        {
            set { _dgvCars.DataSource = value; }
        }

        public DataTable ClientsTable
        {
            set { _dgvClients.DataSource = value; }
        }

        public Action OnAddClient { private get; set; }
        public Action OnDeleteClient { private get; set; }
        public Action OnRegularClients { private get; set; }
        public Action OnBestClients { private get; set; }
        public Action OnFineClietns { private get; set; }
        public Action OnAddCar { private get; set; }
        public Action OnDeleteCar { private get; set; }
        public Action OnGetEmployees { private get; set; }
        public Action OnHireEmployee { private get; set; }
        public Action OnFireEmployee { private get; set; }

        public int SelectedClientIndex
        {
            get { return _dgvClients.SelectedRows[0].Index; }
        }

        public int SelectedEmployeeIndex
        {
            get { return _dgvEmployees.SelectedRows[0].Index; }
        }

        #endregion

        private void _btnAddClient_Click(object sender, EventArgs e)
        {
            OnAddClient();
        }

        private void _btnDeleteClient_Click(object sender, EventArgs e)
        {
            OnDeleteClient();
        }

        private void _btnGetRegularClients_Click(object sender, EventArgs e)
        {
            OnRegularClients();
        }

        private void _btnGetBestClients_Click(object sender, EventArgs e)
        {
            OnBestClients();
        }

        private void _btnGetFineClients_Click(object sender, EventArgs e)
        {
            OnFineClietns();
        }

        private void _btnGetEmployees_Click(object sender, EventArgs e)
        {
            OnGetEmployees();
        }

        private void _btnHireEmployee_Click(object sender, EventArgs e)
        {
            OnHireEmployee();
        }

        private void _btnFireEmployee_Click(object sender, EventArgs e)
        {
            OnFireEmployee();
        }
    }
}